package com.espirit.view;

import java.io.IOException;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.espirit.smc.server.Server;
import com.espirit.smc.server.ServerProperties;
import com.espirit.util.Constant;
import com.espirit.util.PropertiesUtils;

public class ManagerListener implements ServletContextListener {

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		try {
			ServerProperties properties = PropertiesUtils.loadServerProperties(null);
			Server server = new Server(properties);
			sce.getServletContext().setAttribute(Constant.CTX_SERVER, server);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	public void contextDestroyed(ServletContextEvent sce) {

	}

}
